import { BaseViewModel } from '@ohos/lib_common'
import { API } from '../../../common/constants/api'

// 广告banner item
export interface AdvBannerItem {
  bannerId: string
  linkId: string
  wxAppId: string
  ysId: string
  title: string
  linkType: number
  linkUrl: string
  orderNum: number
  bannerAvatar: string
  startTime: string
  endTime: string
  androidFlag: boolean
  iosFlag: boolean
  appletFlag: boolean
}

// 广告banner优先级item
export interface AdvBannerPriorityItem {
  location: number,
  bannerListVOList: AdvBannerItem[]
}

// 请求广告banner数据
export class AdvBannerModel extends BaseViewModel {
  async getAdvBannerData() {
    const res = await this.get<AdvBannerPriorityItem[]>({ url: API.ADV_BANNER })
    return res;
  }
}

export const advBannerModel = new AdvBannerModel();